namespace YoghurtGum
{

	inline Dict::Dict()
	{

	}

	inline Dict::~Dict()
	{

	}

	inline Dict::Entry* Dict::_Find(const char* a_Name)
	{
		std::map<std::string, Entry*>::iterator found = m_Entries.find(a_Name);
		if (found != m_Entries.end())
		{
			return found->second;
		}

		return NULL;
	}

	template <typename T>
	inline void Dict::Set(const char* a_Name, const T& a_Value)
	{
		Entry* found = _Find(a_Name);
		if (!found)
		{
			Entry* result = new Entry;
			result->data = (void*)&a_Value;
			result->size = sizeof(T);

			m_Entries.insert(std::pair<std::string, Entry*>(a_Name, result));
		}
		else
		{
			found->data = new T;
			*(T*)found->data = a_Value;
			found->size = sizeof(T);
		}
	}


	template <typename T>
	inline const T* Dict::Get(const char* a_Key)
	{
		Entry* found = _Find(a_Key);
		if (!found) { return NULL; }

		return (const T*)found->data;
	}

	inline Dict& Dict::operator = (const Dict& a_Other)
	{
		for (std::map<std::string, Entry*>::const_iterator it = a_Other.m_Entries.begin(); it != a_Other.m_Entries.end(); it++)
		{
			Entry* curr = new Entry;
			curr->data = it->second->data;
			curr->size = it->second->size;

			m_Entries.insert(std::pair<std::string, Entry*>(it->first, curr));
		}

		return *this;
	}

}; // namespace YoghurtGum